import numpy as np
from matplotlib import pyplot as plt
from sampEn import *

example = np.loadtxt('example.txt')
ins = example[:,1]
L = len(ins)
m = 2

r_ins = 0.2*np.std(ins)
en_ins = sampen(ins,m,r_ins)
print('sample entropy of ins is ',en_ins)

x_sin = np.linspace(0,20*np.pi,L)
y_sin = np.sin(x_sin)
r_sin = 0.2*np.std(y_sin)
en_sin = sampen(y_sin,m,r_sin)
print('sample entropy of sine data is ',en_sin,"and it's low")

y_rand = np.random.rand(L)
r_rand = 0.2*np.std(y_rand)
en_rand = sampen(y_rand,m,r_rand)
print('sample entropy of random data is ',en_rand,"and it's high")

# plt.plot(range(L),ins)
# plt.show()